package com.xianyun.book.domain.user;

import com.alibaba.cola.exception.BizException;

/**
 * 身份
 * @author macos-zyj
 */
public enum Identity {
    /**老师*/
    TEACHER("teacher"),
    /**学生*/
    STUDENT("student"),
    /**职工*/
    WORKER("worker"),
    /**驻内人员 营业厅 商铺等*/
    RESIDENT("resident");
    private final String identity;

    Identity(String identity) {
        this.identity = identity;
    }

    public static Identity getIdentity(String identity){
        for (Identity current:values()){
            if (current.identity.equals(identity)){
                return current;
            }
        }
        throw new BizException("Identity not found");
    }
}
